package club.justwill.single.persistence.store;

import club.justwill.single.persistence.document.UserSupportProject;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;

/**
 * Created by luoyu on 2/1/16.
 */
@Component
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public class UserSupportProjectStore extends MongoDbStore<UserSupportProject>{
    public UserSupportProject searchSupportedProject(long userId) {
        return mongoTemplate.findOne(Query.query(Criteria.where("user_id").is(userId)),UserSupportProject.class);
    }
}
